package org.lennon.demo.ddd.ticket.repository.impl;

import org.lennon.demo.ddd.ticket.aggregate.TicketRecord;
import org.lennon.demo.ddd.ticket.repository.TicketRecordRepository;
import org.lennon.demo.ddd.ticket.builder.TicketRecordBuilder;
import org.lennon.demo.ddd.ticket.dao.UserTicketRecordMapper;
import org.lennon.demo.ddd.ticket.entity.UserTicketRecordEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class TicketRecordRepositoryImpl implements TicketRecordRepository {

    @Autowired
    private UserTicketRecordMapper userTicketRecordMapper;

    @Override
    public void save(TicketRecord ticketRecord) {
        UserTicketRecordEntity userTicketRecordEntity = TicketRecordBuilder.fromTickerRecord(ticketRecord);
        userTicketRecordMapper.insert(userTicketRecordEntity);
    }

    @Override
    public void save(List<TicketRecord> ticketRecordList) {
        ////....
    }
}
